package com.test.prolenders.config_prolenders;

import android.text.TextUtils;

public class CountryConfig_prolenders {

    //国家区号
    public static final String AreaCode_Kenya = "+254";
    public static final String AreaCode_Ghana = "+233";
    public static final String AreaCode_Cote = "+225";
    public static final String AreaCode_Uganda = "+256";
    public static final String AreaCode_Cameroon = "+237";
    public static final String AreaCode_Zambia = "+260";
    public static final String AreaCode_Senegal = "+221";
    public static final String AreaCode_Tanzan = "+255";

    private static class Inner {
        private static final CountryConfig_prolenders instance = new CountryConfig_prolenders();
    }

    private CountryConfig_prolenders() {}

    public static CountryConfig_prolenders getInstance() {
        return Inner.instance;
    }

    private String front;
    private String areaCode;

    public String getFront() {
        if (TextUtils.isEmpty(front)) return "";
        return front;
    }

    public boolean isFrontEmpty(){
        return TextUtils.isEmpty(front) || front.length()<=1;
    }

    public void setFront(String front) {
        this.front = "/"+ front;
    }

    public String getCommonPath(){
        if (TextUtils.isEmpty(front)) return "";
        return Paths_prolenders.BasePath +getFront()+ Paths_prolenders.CommonPath;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getAreaCode() {
        if (TextUtils.isEmpty(areaCode)) return "";
        if (areaCode.startsWith("+")) return areaCode;
        return "+"+areaCode;
    }

    public boolean isGhana(){
        return AreaCode_Ghana.endsWith(getAreaCode());
    }

    public boolean isCote(){
        return AreaCode_Cote.endsWith(getAreaCode());
    }

    public boolean isKenya(){
        return AreaCode_Kenya.endsWith(getAreaCode());
    }

    public boolean isUganda(){
        return AreaCode_Uganda.endsWith(getAreaCode());
    }

    public boolean isCameroon(){
        return AreaCode_Cameroon.endsWith(getAreaCode());
    }

    public boolean isZambia(){
        return AreaCode_Zambia.endsWith(getAreaCode());
    }

    public boolean isSenegal(){
        return AreaCode_Senegal.endsWith(getAreaCode());
    }

    public boolean isTanzan(){
        return AreaCode_Tanzan.endsWith(getAreaCode());
    }

    public boolean isEnglish(){
        return isKenya()||isGhana()||isUganda()||isZambia();
    }

    public boolean isFrench(){
        return isCote()||isCameroon()||isSenegal();
    }

    public boolean isGetOrderRepayH5(){
        return isUganda()||isKenya();
    }

    public boolean isOrderRepayH5(){
        return !isGetOrderRepayH5();
    }
    
}
